//
//	File Name   :	Thread.cpp
//	Description :	Thread implementation file.
//	Author		:	William McVicar
//  Mail		:	mcvicar.william@gmail.com
//

//  Precompiled Header
#include "CommonDefines.h"

//  Library Includes

//  Local Includes

//  This includes
#include "Thread.h"

//	Macros

//  Static Variables

//  Static Function Prototypes

//  Implementation

Thread::Thread( void* _pFunction, void* _pUserData, unsigned int _uiProcessorNumber, unsigned int _uiStackSize )
: m_pFunction( _pFunction )
, m_pUserData( _pUserData )
, m_uiProcessorNumber( _uiProcessorNumber )
, m_uiStackSize( _uiStackSize )
{
	m_pThread = CreateThread( NULL, 
							 (SIZE_T)_uiStackSize,
							 (LPTHREAD_START_ROUTINE)_pFunction,
							 (LPVOID)_pUserData,
							 CREATE_SUSPENDED,
							 (LPDWORD)&m_uiThreadID );
}

Thread::~Thread()
{

}

bool Thread::Pause()
{
	return ( SuspendThread((HANDLE)m_pThread) != -1 );
}

bool Thread::Resume()
{
	return ( ResumeThread((HANDLE)m_pThread) != -1 );
}